<?php
	$controllerName = Zend_Controller_Front::getInstance()->getRequest()->getControllerName();
	$activeindex = '';
	$activeconfig = '';
	$activecategory = '';
	$activeproduct = '';
    $activechangepass = '';
    $activecart = '';
	$activecustomer = '';
    
    switch ($controllerName) {
        case 'index':
            $activeindex = "class='active'";
            break;
        case 'config':
            $activeconfig = "class='active'";
            break;
        case 'category':
            $activecategory = "class='active'";
            break;
        case 'product':
            $activeproduct = "class='active'";
            break;
        case 'changepass':
            $activechangepass = "class='active'";
            break;
        case 'cart':
            $activecart = "class='active'";
            break;
		case 'customer':
			$activecustomer = "class='active'";
            break;
		case 'search':
			$activeproduct = "class='active'";
            break;
    }
?>
<div class="container">
	<header>
    <div class="header">
        <?php
            if($controllerName == 'index')
            {
                    echo "<div style='float:right'>";
                    echo $this->list_pages;
                    echo "</div>";
            }
        ?>
        <?php
                $list_page = $_SESSION['list_page'];
				$store = App_Models_StoreModel::getInstance();
				$lpage = $store->GetPageFbByIdUserFB();
				@$idpage = $_SESSION['idpage'];
				if(count($lpage) > 0)
				{
		?>
			<!--<a href="#" class="create-page">Tạo trang</a>-->
			<?php
                if($controllerName != 'index')
                {
            ?>
            <select id="slist_page" onchange="ChangeListPage(document.getElementById('slist_page').value)" class="select select_list_page">
				<option value="0">Chọn Page cần thao tác</option>
				<?php
					for($i=0; $i<count($lpage); $i++)
					{
				
					$idpagefb = $lpage[$i]['id_fb_page'];
					$namepafefb = $lpage[$i]['page_name'];
					if($idpagefb == $idpage)
					{
						echo "<option selected='selected' value='$idpagefb'>$namepafefb</option>";
					}
					else
						echo "<option value='$idpagefb'>$namepafefb</option>";
					}
				?>
			</select>
            <?php 
                }
             ?>
			<!--<a href="#" class="upload">Upload</a>-->
        <?php } ?>
        </div>
        
		<div class="navigation">
			<ul>
				<li><a target="_top" href="<?php echo ROOT_DOMAIN ?>/admin" <?php echo $activeindex ?>>Home</a></li>
				<li><a target="_top" href="<?php echo ROOT_DOMAIN ?>/admin/config" <?php echo $activeconfig ?>>Cấu hình</a></li>
				<li><a target="_top" href="<?php echo ROOT_DOMAIN ?>/admin/category" <?php echo $activecategory ?>>Loại sản phẩm</a></li>
				<li><a target="_top" href="<?php echo ROOT_DOMAIN ?>/admin/product" <?php echo $activeproduct ?>>Sản phẩm</a></li>
				<li><a target="_top" href="<?php echo ROOT_DOMAIN ?>/admin/cart" <?php echo $activecart ?>>Đơn hàng</a></li>
				<li><a target="_top" href="<?php echo ROOT_DOMAIN ?>/admin/customer" <?php echo $activecustomer ?>>Quản lý khách hàng</a></li>
			</ul>
            <?php
                
                $checkSessionIdpage = $store->KiemTraSessionIdPage($idpage);
        		if($checkSessionIdpage != 0)
        		{
        			$config_app = Zend_Registry::get(APPLICATION_CONFIG);
                    $appid = $config_app->facebook->appid;
                    $link_app = "https://www.facebook.com/$idpage?sk=app_$appid";
                    echo '<a style="color: #41BBDE; float: right; font-weight: bold; position: absolute; right: 5px; top: 10px;" href="'.$link_app.'" target="_blank">Xem ứng dụng</a>';
        		}
                
                
            ?>
            
		</div>
	</header>